﻿class Delegate {

    public static delegateSample() {
        var items: string[] =
            ['doc', 'bashful', 'dopey', 'sneezy', 'grumpy', 'happy', 'sleepy'];

        var comparer = (first: string, second: string): number => {
            return first.localeCompare(second);
        };

        Delegate.sort(items, comparer);
    }

    static sort(items: string[], comparer: { (first: string, second: string): number; }) {
        return items.sort(comparer);
    }
}
